<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
	<meta charset="utf-8"> 
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=500" />
	<meta name="keywords" content="ScrollMagic, example, scrolling, attaching, scrollbar, parallax" />
	<meta name="author"	content="Jan Paepke (www.janpaepke.de)" />
	<title>Parallax Scrolling - Examples - ScrollMagic</title>

	<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,400italic|Josefin+Slab:400,700italic' rel='stylesheet' type='text/css'>
	<link rel="stylesheet" href="../../assets/css/normalize.css" type="text/css">
	<link rel="stylesheet" href="../../assets/css/style.css" type="text/css">
	<link rel="stylesheet" href="../../assets/css/examples.css" type="text/css">
	<link rel="shortcut icon" href="../../assets/img/favicon.ico" type="image/x-icon">

	<script type="text/javascript" src="../../assets/js/lib/jquery.min.js"></script>
	<script type="text/javascript" src="../../assets/js/lib/highlight.pack.js"></script>
	<script type="text/javascript" src="../../assets/js/lib/modernizr.custom.min.js"></script>
	<script type="text/javascript" src="../../assets/js/examples.js"></script>
	
	<script type="text/javascript" src="../../assets/js/lib/gsap3/gsap.min.js"></script>
	<script type="text/javascript" src="../../scrollmagic/uncompressed/ScrollMagic.js"></script>
	<script type="text/javascript" src="../../scrollmagic/uncompressed/plugins/animation.gsap.js"></script>
	<script type="text/javascript" src="../../scrollmagic/uncompressed/plugins/debug.addIndicators.js"></script>
</head>
<body>
	<ul id="menu"></ul>
	<div id="content-wrapper">
		<div id="example-wrapper" class="horizontal">
			<div class="scrollContent">
				<section id="titlechart">
					<div id="description">
						<h1 class="badge gsap">Parallax Scrolling</h1>
						<h2>No big deal, if you have ScrollMagic.</h2>
						<p>
							Adding a parallax effect to your website is just a matter of assigning different movement speeds for the layers.
						</p>
						<p>
							The most common usecase for this are <a href="../advanced/parallax_sections.html">Parallax Sections</a>.
						</p>
						<a href="#" class="viewsource">view source</a>
					</div>
					<script>
						var controller = new ScrollMagic.Controller({vertical: false});
					</script>
				</section>
				<div class="spacer s0"></div>
				<section class="demo fullwidth">
					<div id="parallaxContainer">
						<div class="layer1">
							<div class="box1 white">
								<p>A box in the sky.</p>
								<a href="#" class="viewsource">view source</a>
							</div>
						</div>
						<div class="layer2"></div>
						<div class="layer3"></div>
					</div>
					<script>
						$(function () { // wait for document ready
							// build tween
							var tween = new TimelineMax ()
								.add([
									TweenMax.to("#parallaxContainer .layer1", 1, {backgroundPosition: "-40% 0", ease: Linear.easeNone}),
									TweenMax.to("#parallaxContainer .layer2", 1, {backgroundPosition: "-500% 0", ease: Linear.easeNone}),
									TweenMax.to("#parallaxContainer .layer3", 1, {backgroundPosition: "-225% 0", ease: Linear.easeNone})
								]);

							// build scene
							var scene = new ScrollMagic.Scene({triggerElement: "#parallaxContainer", duration: 2000, offset: 450})
											.setTween(tween)
											.setPin("#parallaxContainer")
											.addIndicators() // add indicators (requires plugin)
											.addTo(controller);
						});
					</script>
				</section>
				<div class="spacer s4"></div>
				<div class="spacer s0"></div>
				<section class="demo fullwidth" id="trigger2">
					<div id="parallaxText">
						<h1 class="layer1">PARALLAX</h1>
						<h1 class="layer2">PARALLAX</h1>
						<h1 class="layer3">
							PARALLAX
							<a href="#" class="viewsource">view source</a>
						</h1>
						
					</div>
					<script>
						// build tween
						var tween = new TimelineMax ()
							.add([
								TweenMax.fromTo("#parallaxText .layer1", 1, {scale: 3, autoAlpha: 0.05, left: 300}, {left: -350, ease: Linear.easeNone}),
								TweenMax.fromTo("#parallaxText .layer2", 1, {scale: 2, autoAlpha: 0.3, left: 150}, {left: -175, ease: Linear.easeNone})
							]);

						// build scene
						var scene = new ScrollMagic.Scene({triggerElement: "#trigger2", duration: $(window).width()})
										.setTween(tween)
										.addIndicators() // add indicators (requires plugin)
										.addTo(controller);
					</script>
				</section>
				<div class="spacer s_viewport"></div>
			</div>
		</div>
	</div>
	<script type="text/javascript" src="../../assets/js/tracking.js"></script>
</body>
</html>
